package com.face.console.tools.redis;

import com.google.common.cache.Cache;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Liudehua
 * @explain
 * @date 2021/06/11 18:07
 */
public class LocalCacheService {

    @Autowired
    private Cache<String, String> localCache;

    public String get(String key){
        return localCache.getIfPresent(key);
    }

    /**
     *   localService.set(Constant.LOCAL_PREFIX + key, result);
     * @param key
     * @param value
     */
    public void set(String key,String value){
        localCache.put(key,value);
    }

    public void del(String key){
        localCache.invalidate(key);
    }

}
